<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-02-05T15:16:10" />
    </reg:owner>
  </owners>

  <number>90204</number>

  <name>Function test for xfi:concept-data-type</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi:concept-data-type($concept-name as xs:QName) as xs:QName
      </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666"/>

  <variation id="V-01">
    <name>Returns correct data type for c1 concept</name>
    <documentation>
      <xhtml:p>
        Tests that c1 concept returns a data type of xbrli:stringItemType.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V01" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V01">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:c1')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:QName and
         count( $result ) eq 1 and
         $result eq QName('http://www.xbrl.org/2003/instance','xbrli:stringItemType') 
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Returns correct data type for c2 concept</name>
    <documentation>
      <xhtml:p>
        Tests that c2 concept returns a data type of xbrli:monetaryItemType.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V02" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V02">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:c2') 
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:QName and
         count( $result ) eq 1 and
         $result eq QName('http://www.xbrl.org/2003/instance','xbrli:monetaryItemType') 
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Returns correct data type for t1 tuple</name>
    <documentation>
      <xhtml:p>
        This tuple has an anonymous type, which according to function description returns an empty sequence.
        (In prior version of test case, this test assumed that
        tuple concept data type is xs:anyType because tuples
        are complexContent which have xs:anyType as their restriction base.)
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V03" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V03">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:t1')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <!-- HF 2011-03-18 this was the prior result, changed to empty sequence
      <cfcn:test>
         $result instance of xs:QName and
         count( $result ) eq 1 and
         $result eq QName('http://www.w3.org/2001/XMLSchema','xs:anyType') 
      </cfcn:test>
      -->
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03a">
    <name>Returns correct data type for t2 tuple</name>
    <documentation>
      <xhtml:p>
        Tuple t2 has a complex type which is not anonymous, type QName is returned.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V03a" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V03a">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:t2')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:QName and
         count( $result ) eq 1 and
         $result eq xs:QName('concept:myTuple') 
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Raises an error for non-xbrl element argument</name>
    <documentation>
      <xhtml:p>
        Tests that error is detected when the element is not an XBRL
        concept.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V04" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V04">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:nonXbrlElement')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidConceptQName</error>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Raises an error for an attribute declaration argument</name>
    <documentation>
      <xhtml:p>
        Tests that error is detected when the argument declares an attribute.
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V05" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V05">
        xfi:concept-data-type(
          QName('http://xbrl.org/formula/conformance/example','concept:anAttribute')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidConceptQName</error>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Raises an error for an xbrli namespace&apos;ed argument</name>
    <documentation>
      <xhtml:p>
        Tests that error is detected when the argument is xbrli:item
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V06" xlink:type="simple" xlink:href="concept-data-type.xsd"/>
      <cfcn:call file="V06">
        xfi:concept-data-type(
          QName('http://www.xbrl.org/2003/instance','xbrli:item')
          )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:invalidConceptQName</error>
    </outputs>
  </variation>

  <revisions>
    <reg:revision on="2008-02-05T15:16:10" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>




